class Solution(object):
    def rob(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        # if len(nums) < 1:
        #     return 0
        # if len(nums) == 1:
        #     return nums[0]
        # cur_pre = self.rob(nums[2:])
        # pre_pre = self.rob(nums[3:])
        # return max(cur_pre + nums[0], pre_pre + nums[1])
        self.max_rob = [0] * (len(nums)+2)
        # self.max_rob[-1] = nums[-1]
        for i in range(len(nums)-1, -1, -1 ):
            self.max_rob[i] = max(self.max_rob[i+2] + nums[i], self.max_rob[i+1])
        return self.max_rob[0]


